﻿using System;

namespace HowManyTimesNumAppearInArr
{
    public class HowManyTimesNumAppearInArr
    {
        public static int NumberCountArray<T>(T[] array, T number)
        {
            int count = 0;
            for (int index = 0, length = array.Length; index < length; index++)
            {
                if (array[index] == number)
                {
                    count++;
                }
            }
            return count;
        }

        static void Main(string[] args)
        {
            double[] array = { 1, 2, 3, 4, 5, 6, 1, 2, 1, 2, 2, 2, 1 };
            int number = 2;
            Console.WriteLine(NumberCountArray(array, number));
        }
    }
}
